﻿<!DOCTYPE>
<html ng-app="OtherMain">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width, minimal-ui"> -->
    <script src="/framework/angular.min.js"></script>
    <title>档案加载中...</title>

	<style type="text/css">

		body {
			margin: 0;
			background-color:#8f9ab0;
			font-family: "Hiragino Sans GB","Microsoft YaHei","WenQuanYi Micro Hei",sans-serif,"lucida grande","lucida sans unicode",lucida,helvetica;
			font-size: 14px;
			height: 100%;
			-webkit-touch-callout: none;
			-webkit-user-select: none;
			-khtml-user-select: none;
			-moz-user-select: none;
			-ms-user-select: none;
			user-select: none;
		}
		.xuexidangan_title{font-size:20px;margin-bottom:20px}
		.xuexidangan{width:1170px;margin:0 auto 50px;background-color: #8f9ab0;padding: 50px 0;}
		.xuexidangan_main{width: 1030px;margin:40px auto;border:1px solid #ccc;border-radius:5px;background-color:#f4f4f4}
		.btn-toolbar{position:fixed;right:0;top:80px}
		table{border-collapse:collapse}
		table tr td{border-bottom:1px solid #dedede;padding:10px}
		.xuexidangan_xxqk_liebiao_xxcj{display:none !important}
		.xuexidangan_xxqk_liebiao_xxsc{width:33%}
		.xuexidangan_xxqk_liebiao_xxjd{width:28%}
		.xuexidangan_xxqx_left{float:left;width:45%;line-height:35px;height:inherit;    position: relative;}
		.xuexidangan_xxqx_right{float:right;width:50%;position:initial;padding:10px;border-radius:5px;border:1px solid #ddd;right: 30px; top: 45px;}
		.xuexidangan_xxqx{overflow:hidden;margin-bottom:40px;    position: relative;right: 0;}
		.xuexidangan_xxqx_right table td{color:#717171;font-size:13px}
		.xuexidangan_xxqx_right table {
			width: 460px;
		}
		.xuexidangan_third>div {
			width: 1030px;
			margin: 0 auto;
		}
		.xuexidangan_third{}
		.xuexidangan_column{padding:35px;margin-top:0px;border:1px solid #ccc;margin:10px;border-radius:5px;background-color:#fff;position: relative;line-height: 28px;}
		.xuexidangan_name {
			font-size: 22px;
		}
		.xuexidangan_column:first-child{font-size:14px;line-height:28px;margin:0;border:0;border-bottom:1px solid #ccc;overflow:hidden}
		.tab_left div:first-child{text-align:center}
		.col_tab{width:100%;font-size:14px;color:#2d2d2d}
		.col_paper_tab{width:100%;font-size:14px;color:#2d2d2d}
		.col_paper_tab tr:nth-child(2n){background-color:#f4433614}
		.col_tab tr:nth-child(2n){background-color:#2196f324}
		.rowspan_col{border-right:1px solid #ddd;width:20px}
		.tab_box{border:1px solid #ddd;border-radius:5px;margin-top:30px}
		.tab_title{border-bottom:1px solid #ddd;padding:10px 0;font-weight:bold;color:#666;font-size:15px}
		.tab_box_title{text-align:center;background-color:#eee;padding:10px}
		.tab_title span{padding:0 25px}
		.tab_box .tab_title{text-align:center}
		.xuexidangan_title{margin:0}
		.toggle_a{float:right;color:#39f;font-size:15px;cursor:pointer}
		.xuexidangan_title span{font-size:14px;color:#999;padding:0 10px}
		.tab_content{overflow:hidden;border-bottom:1px solid #ddd}
		.tab_left{float:left;width:27%;padding-left:1%}
		.tab_left .attr_div{line-height:30px;background-color:#eee;margin:10px 0;border-radius:20px;padding:0 10px}
		.tab_left .attr_div strong{font-size:13px}
		.tab_right{float:right;width:70%;border-left:1px solid #dddd;min-height:210px}
		.xuexidangan_touxiang img{border-radius:50%;border:4px solid #ccc;height:100px}
		.report_box{height:400px;background-color:#eee}
		.watermark-image{position:absolute;margin:auto;width:1170px;height:100%;background:url('/images/logo_fff.png') no-repeat;background-size:300px;border:1px dotted #f00}
		.watermark-image:before{content:"Message here.";font-size:21pt;position:absolute;top:50%;left:50%;margin-left:-80px;-webkit-transform:rotate(-45deg)}
		.xuexidangan_number{overflow:hidden;color:#999}
		.xuexidangan_yemei {
			font-size: 28px;
			text-align: center;
		}
		.xuexidangan>div {
			width: 1170px;
			background-color: #fff;
			margin: 0 auto 50px;
			padding: 15px;
			box-sizing: border-box;
			border-radius: 3px;
			position:relative;overflow:hidden
		}
		.download_img{
			width: 200px;
			height: 300px;
			background-color: #333;
			position: fixed;
			right: 0;
			bottom: 0;
			border: 0;
			text-align: center;
		}
		.download_img img{
			height: 100%;
		}
		.export_box{
			position: absolute;
			right: 25px;
			bottom: 35px;
			color: #a5a5a5;
			text-align: right;
			font-size: 13px;
		}
		.export_box button{
			background-color: #39f;
			color: #fff;
			border: 0;
			padding: 5px 10px;
			border-radius: 5px;
			cursor: pointer;
		}
		.export_box button:hover{
			background-color:#177ce0
		}
		@media (max-width: 768px) { 
			.xuexidangan{
				width: 100%;
			}
		}
	</style>
    
</head>

<body ng-controller="OtherCtrl" ng-cloak>
	
		<div class="xuexidangan" id="ryda">
			<!-- <img ng-src="{{nameImg}}"/> -->
			<div class="xuexidangan_first">


				<div class="xuexidangan_number">
					<span>档案号：{{userinfo.user_No}}</span>
					<span style="float:right" ng-click="hideSY()"><img ng-src="{{fileurl+'/resources/logo/'+userinfo.organization_ID+'_1.png'}}" style="height: 30px;" onerror="javascript:this.src='/images/logo.png'"></span>
				</div>
				<div class="xuexidangan_yemei">学习档案</div>
				<div class="xuexidangan_main">
					
					<div class="xuexidangan_column">

						<div>
							<div class="xuexidangan_name">{{userinfo.user_Name}}
								<span class="xuexidangan_gery">{{userinfo.user_Account}}</span>
							</div>
							<div>
								性别：{{userinfo.user_Sex == '0'?'女':userinfo.user_Sex == '1'?'男':'-'}}
								
							</div>
							<div>
								联系邮箱：{{userinfo.email?userinfo.email:'暂无'}}
							</div>
							<div>
								手机号码：{{userinfo.phone?userinfo.phone:'暂无'}}
							</div>
							<div>
								角色：
								<span ng-if="userinfo.userRoleList.length<=0">暂无</span>
								<span ng-repeat="value in userinfo.userRoleList">{{value.roles_Name}}</span>
							</div>
							<div>
								用户组：
								<span ng-if="userinfo.userGroupList.length<=0">暂无</span>
								<span ng-repeat="value in userinfo.userGroupList">{{value.userGroup_Name}}</span>
							</div>
							<div>
								组织架构：
								<span ng-if="userinfo.orgList.length<=0">暂无</span>
								<span ng-repeat="value in userinfo.userOrgList">{{value.organization_Name}}</span>
							</div>

						</div>
						
						<div class="export_box" ng-if="yearList.length>0">
							<!-- <img ng-src="{{userinfo.user_Img}}" /> -->
							<button ng-click="exportData()">导出EXCEL</button>
							<div>注意：仅导出已展开的年度数据</div>
						</div>
						
					</div>
					<div class="xuexidangan_column" style="display: none;">
						<div class="xuexidangan_title">汇总档案</div>
						<div>
							总学习时长：<span class="xuexidangan_blue">0</span>
							<span class="xuexidangan_gery"></span>
						</div>
						<div>
							科目总学习时长<span class="xuexidangan_blue">0</span>
						</div>
						<div>
							学习课程数：<span class="xuexidangan_blue">0个</span>
						</div>
						<div>
							考试次数: <span class="xuexidangan_blue">0次</span>
						</div>
						<div>
							任务数量：<span class="xuexidangan_blue">0个</span>
						</div>
					</div>
					<div class="xuexidangan_column">
						<div class="xuexidangan_fkmhz">
							<div class="xuexidangan_title">汇总学习</div>
							<div class="xuexidangan_xxqx">
								<div class="xuexidangan_xxqx_left">
									<div class="xuexidangan_xxqx_left_title">
										<span>年度学时记录</span>
									</div>
									<div id="stu_container" class="xuexidangan_xxqx_left_body"
										style="height: 330px;"></div>
								</div>
								<div class="xuexidangan_xxqx_right">
									<table width="460" border="0" cellspacing="5" cellpadding="5">
										<tr>
											<td>年度</td>
											<td>必修学时</td>
											<td>选修学时</td>
										</tr>
											<tr ng-repeat="value in yearList">
												<td>{{value.year}}年度</td>
												<td>{{value.bxTotleStudyTime}}分钟</td>
												<td>{{value.xxTotleStudyTime}}分钟</td>
											</tr>
									</table>
								</div>
							</div>
							<div class="xuexidangan_xxqx">
								<div class="xuexidangan_xxqx_left">
									<div class="xuexidangan_xxqx_left_title">
										<span>成绩TOP10</span>
									</div>
									<div id="exam_container" class="xuexidangan_xxqx_left_body"
										style="height: 330px;"></div>
	
								</div>
								<div class="xuexidangan_xxqx_right">
									<table width="460" border="0" cellspacing="5" cellpadding="5">
										<tr>
											<td>试卷</td>
											<td>得分</td>
											<td>是否及格</td>
											<td>考试日期</td>
										</tr>
											<tr ng-repeat="value in scoreList">
												<td style="text-align: left;">{{value.paperName}}</td>
												
												<td>{{value.score}}</td>
												<td>{{value.ispass=="0"?'及格':'未及格'}}</td>
												<td>{{value.scoreTime.split(" ")[0]}}</td>
											</tr>
										
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>




			<div class="xuexidangan_third" ng-repeat="year in yearList">
				<div data-spy="scroll" data-target="#navbar-example" data-offset="0">
					<h1>{{year.year}}年度
						<a class="toggle_a" ng-if="!year.loading" ng-click="hideYearBox(year)">{{year.show?'收起':'展开'}}</a>
						<a class="toggle_a" ng-if="year.loading">数据载入中...</a>
					</h1>
					<div class="xuexidangan_main" ng-show="year.show&&!year.loading">
						
						<!--年度统计学分学时图形表-->
						<div class="xuexidangan_column">
							<div class="xuexidangan_xxqx_left" style="width: 20%;">
								<div class="xuexidangan_title">学分统计</div>
								<div>
									已获得必修总学分：{{year.bxCompleteIntegral}}
								</div>
								<div>
									已获得选修总学分：{{year.xxCompleteIntegral}}
								</div>
								<div>
									应获得必修总学分：{{year.bxIntegralShouldCount}}
								</div>
								<div>
									必修积分完成率：{{year.bxCompleteIntegral==0?'0':((year.bxCompleteIntegral/year.bxIntegralShouldCount)*100).toFixed(2)}}%
								</div>
								<div class="xuexidangan_title" style="margin-top: 25px;">培训统计</div>
								<div>
									获得必修总学时：<span class="xuexidangan_blue">{{year.bxTotleStudyTime}}</span>
								</div>
								<div>
									获得选修总学时：<span class="xuexidangan_blue">{{year.xxTotleStudyTime}}</span>
								</div>
								<div>
									已完成必修任务数：<span class="xuexidangan_blue">{{year.bxCompleteArrangeCount}}</span>
								</div>
								<div>
									应完成必修任务数: <span class="xuexidangan_blue">{{year.bxArrangeShouldCount}}</span>
								</div>
								<div>
									必修任务完成率：<span class="xuexidangan_blue">{{year.bxCompleteArrangeCount==0?'0':((year.bxCompleteArrangeCount/year.bxArrangeShouldCount)*100).toFixed(2)}}%</span>
								</div>
							</div>
							<div class="xuexidangan_xxqx_left" style="width: 80%;">
								<div id="{{year.year}}report" class="report_box"></div>
							</div>
						</div>


						<!--月份统计-->
						<div class="xuexidangan_column" ng-if="year.monthList.length>0" ng-repeat="month in year.monthList">
							<div class="xuexidangan_title">{{month.month}}月份<span>（{{year.year}}）</span> <a class="toggle_a" ng-click="hideBox(month)">{{month.show?'收起':'展开'}}</a></div>

							<!--月份-任务统计-->
							<div class="tab_box" ng-if="month.show&&month.list.length>0">
								<!-- <div class="tab_box_title">教学计划统计</div> -->
								<div class="tab_box_title">任务统计</div>
								<div ng-repeat="arrange in month.list">
									<div class="tab_title" ng-if="false">
										<h3>教学计划：新人培训计划</h3>
										<span>完成进度：59.5%</span>
										<span>获得必修学分：585</span>
										<span>获得选修学分：60</span>
									</div>
									<div class="tab_content">
										<div class="tab_left">
											<div class="attr_div">任务属性</div>
											<div class="attr_div">任务名称：<strong ng-bind="arrange.name"></strong></div>
											<div class="attr_div">选 / 必修：<strong ng-bind="arrange.isStudy?'必修':'选修'"></strong></div>
											<div class="attr_div">完成进度：<strong>{{((arrange.completeCount/arrange.courser_count)*100).toFixed(2)}}%</strong></div>
											<div class="attr_div">获得学分：<strong>{{arrange.arrIntegral}}/{{arrange.integral}}</strong></div>
											<!-- <div class="attr_div">创建时间：<strong ng-bind="arrange.create_Date"></strong></div> -->
										</div>
										<div class="tab_right">
											<table cellpadding="10"  class="col_tab" ng-if="arrange.studyList.length>0">
												<tbody>
													<tr>
														<td rowspan="{{arrange.studyList.length+1}}" class="rowspan_col">课程</td>
														<td style="width: 35%;">课程名称</td>
														<td>学习日期</td>
														<td>学习时长</td>
														<td>学习进度</td>
													</tr>
													<tr ng-repeat="study in arrange.studyList">
														<td ng-bind="study.course_name"></td>
														<td ng-bind="study.create_date.split(' ')[0]"></td>
														<td ng-bind="study.stu_count"></td>
														<td ng-bind="study.learning_progress"></td>
													</tr>
												</tbody>
											</table>
											<table cellpadding="10"  class="col_paper_tab" ng-if="arrange.scoreList.length>0">
												<tbody>
													<tr>
														<td rowspan="{{arrange.scoreList.length+1}}" class="rowspan_col">试卷</td>
														<td style="width: 35%;">试卷名称</td>
														<td>考试日期</td>
														<td>是否合格</td>
														<td>考试成绩</td>
													</tr>
													<tr ng-repeat="exam in arrange.scoreList">
														<td ng-bind="exam.paperName"></td>
														<td ng-bind="exam.scoreTime.split(' ')[0]"></td>
														<td ng-bind="exam.ispass==0?'及格':'不及格'"></td>
														<td ng-bind="exam.score"></td>
													</tr>
												</tbody>
											</table>
										</div>
									</div>
								</div>

							</div>

							<!--月份-班级统计-->
							<div class="tab_box" ng-if="month.show&&month.glist.length>0">
								<div class="tab_box_title">
									<div>班级统计</div>
								</div>
								<div ng-repeat="grade in month.glist">
									<div class="tab_content">
										<div class="tab_left">
											<div class="attr_div">班级属性</div>
											<div class="attr_div">班级名称：<strong ng-bind="grade.gradeName"></strong></div>
											<div class="attr_div">开课日期：<strong ng-bind="grade.lineStartDate"></strong></div>
											<div class="attr_div">学习天数：<strong ng-bind="grade.gradeDuration"></strong></div>
											<div class="attr_div">签到次数：<strong ng-bind="grade.attList.length"></strong></div>
										</div>
										<div class="tab_right">
											<table cellpadding="10"  class="col_tab" ng-if="grade.attList.length>0">
												<tbody>
													<tr>
														<td style="width: 35%;">课程主题</td>
														<td>开课时间</td>
														<td>签到时间</td>
														<!-- <td>学时</td> -->
													</tr>
													<tr ng-repeat="att in grade.attList">
														<td ng-bind="att.courseName"></td>
														<td>{{att.sDate.split(' ')[0]}}<br/> {{att.stime}}-{{att.etime}}</td>
														<td ng-bind="att.signTime"></td>
														<!-- <td ng-bind="att.studyTime"></td> -->
													</tr>
												</tbody>
											</table>
										</div>
									</div>
								</div>


							</div>

						</div>



					</div>
				</div>
			</div>










			
		</div>

		<canvas id="name_canvas" style="display: none;"></canvas>
		<!-- <div class="download_img">
			<a src="" target="blank" download="人员档案">
				<img src=""/>
			</a>
		</div> -->
		

	<script src="/framework/xlsx/shim.min.js"></script>
	<script src="/framework/xlsx/jszip.js"></script>
	<script src="/framework/xlsx/xlsx.js"></script>

    <script src="/framework/lodash.min.js" type="text/javascript"></script>
    <script src="/framework/restangular/restangular.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.min.js"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.tpls.min.js"></script>
    <script src="/framework/angular-wang-editor/dist/js/lib/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="/framework/echarts/echarts.js" type="text/javascript"></script>
    <script src="/system/service/common.js" type="text/javascript"></script>
	<script type="text/javascript">

        var mainApp = angular.module("OtherMain", ['Common', 'personnelmanagementS']).config(['$locationProvider', function ($locationProvider) {
            $locationProvider.html5Mode({
                enabled: true,
                requireBase: false//必须配置为false，否则<base href=''>这种格式带base连接的地址才能解析
            });
        } ]);

        //RequestPopService 请求后端的服务，来自==>/system/service/personnelpathservice.js，并且需先引入该模块的名字（上方personnelmanagementS）
        //sysUserInfo  用户信息
        //Restangular  设置token拦截
        mainApp.controller('OtherCtrl', ['$scope','RequestPopService', 'sysUserInfo', 'Restangular', function ($scope, RPS,sysUserInfo, Restangular) {

            //已登录的情况下，需要设置全局token设置
            Restangular.addFullRequestInterceptor(function (element, operation, route, url, headers, params, httpConfig) {
                
                //这个地方需要把登录得到的token写入到请求数据的头文件中
                var usertoken = sysUserInfo.getuserinfotoken().toString();
                if (usertoken == undefined || usertoken == null || usertoken == "") {
                    usertoken="";
                }
                return {
                    headers: { "X-Session-Token": usertoken, "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" }
                };
            });

			var uid = window.location.search.split("=")[1];

			//========================================================================
			//*********************************导出***********************************
			//========================================================================

			//导出
			$scope.exportData=function(){

				// 单元格样式
				var styleBase = {
					font: {
						name: '微软雅黑',
						bold: true,
						sz: 10,
						wrapText:true
					},
					alignment: {
						horizontal: "center" ,
						vertical: "center",
						wrap_text: true
					},
					border: { // 设置边框
						top: { style: 'thin' },
						bottom: { style: 'thin' },
						left: { style: 'thin' },
						right: { style: 'thin' }
					}
				};
				var styleTitle={
					font: {
						name: '微软雅黑',
						bold: true,
						sz: 14,
						wrapText:true
					},
					alignment: {
						horizontal: "center" ,
						vertical: "center",
						wrap_text: true
					},
					border: { // 设置边框
						top: { style: 'thin' },
						bottom: { style: 'thin' },
						left: { style: 'thin' },
						right: { style: 'thin' }
					}
				}
				var styleHead={
					font: {
						name: '微软雅黑',
						bold: true,
						sz: 10,
						wrapText:true
					},
					alignment: {
						horizontal: "center" ,
						vertical: "center",
						wrap_text: true
					},
					border: { // 设置边框
						top: { style: 'thin' },
						bottom: { style: 'thin' },
						left: { style: 'thin' },
						right: { style: 'thin' }
					},
					// fill:{ 
					// 	bgColor: { rgb: "30000000"  }
					// }
					fill: { bgColor: { indexed: 64 }, fgColor: { rgb: "CCCCCC" } }
				}
				var data = [];

				//汇总头部
				var wsTotle = XLSX.utils.aoa_to_sheet([["用户信息","","","","",
														"年份","学分统计","","","",
														"学时统计","","","",""]]);

				XLSX.utils.sheet_add_aoa(wsTotle, [["编号","姓名","组织架构","用户组","角色",
					"年份","已获得必须总学分","已获得选修总学分","应获得必修总学分","必修积分完成率",
					"获得必修总学时","获得选修总学时","已完成必修任务数","应完成必修任务数","必修任务完成率"]], {origin: -1});//拼加行

				const wsrows = [{ hpx: 35 },{ hpx: 25 }];
				
				var yindex=2;
				$scope.yearList.forEach(function(obj,index){

					if(obj.show){
						yindex++;
						wsrows.push({ hpx: 25 });
						var year=[
							$scope.userinfo.user_No,
							$scope.userinfo.user_Name,
							$scope.userinfo.orgname,
							$scope.userinfo.groupname,
							$scope.userinfo.rolename,

							obj.year,

							obj.bxCompleteIntegral,
							obj.xxCompleteIntegral,
							obj.bxIntegralShouldCount,
							(obj.bxCompleteIntegral==0?'0':((obj.bxCompleteIntegral/obj.bxIntegralShouldCount)*100).toFixed(2))+"%",

							obj.bxTotleStudyTime,
							obj.xxTotleStudyTime,
							obj.bxCompleteArrangeCount,
							obj.bxArrangeShouldCount,
							(obj.bxCompleteArrangeCount==0?'0':((obj.bxCompleteArrangeCount/obj.bxArrangeShouldCount)*100).toFixed(2))+"%"

						];
						data.push(year)
					}
				})
				
				XLSX.utils.sheet_add_aoa(wsTotle, data, {origin:{r:2, c:0}});  //从1第3行。第1列插入; 

				wsTotle["!merges"] = [

					//合并列
					{ s: {c: 0,r: 0}, e: {c: 4,r: 0} },//汇总信息
					{ s: {c: 6,r: 0}, e: {c: 9,r: 0} },//汇总信息
					{ s: {c: 10,r: 0}, e: {c: 14,r: 0} },//汇总信息

					//合并行
					{ s: {c: 0,r: 2}, e: {c: 0,r: yindex-1} },//人员编号   开始列，行坐标，结束列行坐标
					{ s: {c: 1,r: 2}, e: {c: 1,r: yindex-1} },//姓名
					{ s: {c: 2,r: 2}, e: {c: 2,r: yindex-1} },//组织架构
					{ s: {c: 3,r: 2}, e: {c: 3,r: yindex-1} },//用户组
					{ s: {c: 4,r: 2}, e: {c: 4,r: yindex-1} },//角色
				];

				const wscols = [
					{ wpx: 120 },
					{ wpx: 100 },
					{ wpx: 200 },
					{ wpx: 200 },
					{ wpx: 200 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 },
					{ wpx: 100 }
				]

				for( let key in wsTotle ){
					if(key.indexOf("!")==-1){
						wsTotle[key].s=styleBase;
					}
				}

				for(var i=0;i<wscols.length;i++){    
					var chat=String.fromCharCode(65+i);
					
				}

				for(var i=0;i<wscols.length;i++){    
					var chat=String.fromCharCode(65+i);
					wsTotle[chat+"1"].s=styleTitle;
					wsTotle[chat+"2"].s=styleHead;
				}
				
				wsTotle['!cols'] = wscols;
				wsTotle['!rows'] = wsrows;

				/* add to workbook */
				var wb = XLSX.utils.book_new();
					
				XLSX.utils.book_append_sheet(wb, wsTotle, "档案汇总");

				
				/********************************************************************年度*********************************************************/

				
				for(var a=0;a<$scope.yearList.length;a++){

					if($scope.yearList[a].show){
						//年度头部
						var wsYear = XLSX.utils.aoa_to_sheet([["","任务","","",
																"课程","","","",
																"试卷","","","",
																"班级","","","",
																"线下课","","",""]]);
						XLSX.utils.sheet_add_aoa(wsYear, [
							["月份","任务名称","完成进度","获得学分",
							"课程名称","学习时间","学习时长","学习进度",
							"试卷名称","考试时间","考试成绩","是否合格",
							"班级名称","开课日期","天数","签到次数",
							"课程主题","开课时间","签到日期","学时",]], {origin: -1});//拼加行
						const yearCols = [
							{ wpx: 50 },
							{ wpx: 180 },
							{ wpx: 80 },
							{ wpx: 80 },

							{ wpx: 180 },
							{ wpx: 80 },
							{ wpx: 50 },
							{ wpx: 50 },

							{ wpx: 180 },
							{ wpx: 80 },
							{ wpx: 50 },
							{ wpx: 50 },

							{ wpx: 180 },
							{ wpx: 180 },
							{ wpx: 50 },
							{ wpx: 50 },

							{ wpx: 180 },
							{ wpx: 180 },
							{ wpx: 150 },
							{ wpx: 150 },
						]
							
						const yearRows = [{ hpx: 35 },{ hpx: 25 }];

						//合并行，列数据
						var hblist=[
							//合并列
							{ s: {c: 1,r: 0}, e: {c: 3,r: 0} },
							{ s: {c: 4,r: 0}, e: {c: 7,r: 0} },
							{ s: {c: 8,r: 0}, e: {c: 11,r: 0} },
							{ s: {c: 12,r: 0}, e: {c: 15,r: 0} },
							{ s: {c: 16,r: 0}, e: {c: 19,r: 0} },

							//合并行
							// { s: {c: 0,r: 0}, e: {c: 0,r: 1} },//汇总信息
						]

						//年度
						var year=$scope.yearList[a];

						var mindex=2;
						var mlist=[];//月份
						var slist=[];//学习
						var elist=[];//考试
						var alist=[];//任务
						var glist=[];//班级
						var attlist=[];//线下签到

						if(year.monthList!=undefined&&year.monthList.length>0){

							

							year.monthList.forEach(function(month,index){
								

								var maxRow=0;//一个月份产生的总行数，N个任务+N班级

								var aindex=0;//一个任务产生的行数，N学习记录+考试记录
								//遍历任务
								if(month.list!=undefined&&month.list.length>0){

									for(var arr=0;arr<month.list.length;arr++){
										var arrange=month.list[arr];

										//任务包含的试卷、课程最大占行数
										var arrcount=(arrange.studyList.length>arrange.scoreList.length?arrange.studyList.length:arrange.scoreList.length);

										slist=[];
										
										//遍历任务的学习记录
										if(arrcount>0){
											
											for(var s=0;s<arrcount;s++){
												
												var study=arrange.studyList[s];
												var exam=arrange.scoreList[s];

												var array=[];
												array.push(month.month+"月")
												array.push(arrange.name+"（"+(arrange.isStudy?'必修':'选修')+"）")
												array.push(((arrange.completeCount/arrange.courser_count)*100).toFixed(2)+"%")
												array.push(arrange.arrIntegral)
												if(study!=undefined){
													array.push(study.course_name)
													array.push(study.create_date.split(' ')[0])
													array.push(study.stu_count)
													array.push(study.learning_progress)
												}else{
													array.push("")
													array.push("")
													array.push("")
													array.push("")
												}

												if(exam!=undefined){
													array.push(exam.paperName)
													array.push(exam.scoreTime.split(' ')[0])
													array.push(exam.score)
													array.push(exam.ispass==0?'及格':'不及格')
													
												}else{
													array.push("")
													array.push("")
													array.push("")
													array.push("")
												}
												slist.push(array);
											}
										}else{
											var array=[];
											array.push(month.month+"月")
											array.push(arrange.name+"（"+(arrange.isStudy?'必修':'选修')+"）")
											array.push(((arrange.completeCount/arrange.courser_count)*100).toFixed(2)+"%")
											array.push(arrange.arrIntegral)
											array.push("")
											array.push("")
											array.push("")
											array.push("")
											array.push("")
											array.push("")
											array.push("")
											array.push("")
											slist.push(array);
										}
										//写入任务学习记录，外层总行数+内层任务已遍历行数
										XLSX.utils.sheet_add_aoa(wsYear, slist, {origin:{r:mindex+aindex, c:0}}); 

										if(slist.length>1){
											hblist.push({ s: {c: 1,r: mindex+aindex}, e: {c: 1,r: mindex+aindex+slist.length-1} });//任务的列合并情况
											hblist.push({ s: {c: 2,r: mindex+aindex}, e: {c: 2,r: mindex+aindex+slist.length-1} });
											hblist.push({ s: {c: 3,r: mindex+aindex}, e: {c: 3,r: mindex+aindex+slist.length-1} });
										}
										aindex+=slist.length;

										

									}//一个任务循环结束

								}
								
								var gindex=0;
								//遍历班级
								if(month.glist!=undefined&&month.glist.length>0){

									var glist=[];

									for(var g=0;g<month.glist.length;g++){
										var grade=month.glist[g];
										
										attlist=[];
										//遍历线下签到
										if(grade.attList!=undefined&&grade.attList.length>0){
											
											for(var b=0;b<grade.attList.length;b++){
												att=grade.attList[b];
												attlist.push([grade.gradeName,grade.lineStartDate,grade.gradeDuration,grade.attList.length,att.courseName,att.sDate.split(' ')[0]+" "+att.stime+"-"+att.etime,att.signTime,att.studyTime])
											}

											//写入考勤
											XLSX.utils.sheet_add_aoa(wsYear, attlist, {origin:{r:mindex+gindex, c:12}});  //从第2行。第2列插入

											if(grade.attList.length>0){
												hblist.push({ s: {c: 12,r: mindex+gindex}, e: {c: 12,r: mindex+gindex+grade.attList.length-1} });//班级的列合并情况
												hblist.push({ s: {c: 13,r: mindex+gindex}, e: {c: 13,r: mindex+gindex+grade.attList.length-1} });//班级的列合并情况
												hblist.push({ s: {c: 14,r: mindex+gindex}, e: {c: 14,r: mindex+gindex+grade.attList.length-1} });//班级的列合并情况
												hblist.push({ s: {c: 15,r: mindex+gindex}, e: {c: 15,r: mindex+gindex+grade.attList.length-1} });//班级的列合并情况
												gindex+=grade.attList.length;
											}else{
												gindex+=1;
											}
										}else{
											attlist.push([grade.gradeName,grade.lineStartDate,grade.gradeDuration,grade.attList.length,"","","",""])
											//写入考勤
											XLSX.utils.sheet_add_aoa(wsYear, attlist, {origin:{r:mindex+gindex, c:12}});
											gindex+=1;
										}
									}

									// //写入班级
									// XLSX.utils.sheet_add_aoa(wsYear, glist, {origin:{r:mindex, c:12}});  //从第mindex行。第12列插入
								}

								if(gindex<aindex){
									maxRow=aindex;
									var cha=aindex-gindex;//差的行数
									glist=[];
									for(var g=0;g<aindex-gindex;g++){
										glist.push(["","","","","","","",""])
									}
									//写入空班级
									XLSX.utils.sheet_add_aoa(wsYear, glist, {origin:{r:mindex+gindex, c:12}});  //从第mindex行。第12列插入

									hblist.push({ s: {c: 12,r: mindex+gindex}, e: {c: 12,r: mindex+aindex-1} });//班级空列全部合并
									hblist.push({ s: {c: 13,r: mindex+gindex}, e: {c: 13,r: mindex+aindex-1} });//班级空列全部合并
									hblist.push({ s: {c: 14,r: mindex+gindex}, e: {c: 14,r: mindex+aindex-1} });//班级空列全部合并
									hblist.push({ s: {c: 15,r: mindex+gindex}, e: {c: 15,r: mindex+aindex-1} });//班级空列全部合并

									hblist.push({ s: {c: 16,r: mindex+gindex}, e: {c: 16,r: mindex+aindex-1} });//考勤空列全部合并
									hblist.push({ s: {c: 17,r: mindex+gindex}, e: {c: 17,r: mindex+aindex-1} });
									hblist.push({ s: {c: 18,r: mindex+gindex}, e: {c: 18,r: mindex+aindex-1} });
									hblist.push({ s: {c: 19,r: mindex+gindex}, e: {c: 19,r: mindex+aindex-1} });
								}else{
									maxRow=gindex;
									var cha=gindex-aindex;//差的行数
									glist=[];
									for(var g=0;g<gindex-aindex;g++){
										glist.push([month.month+"月","","","","","","","","","","",""])
									}

									//写入空学习考试记录,任务哪里默认拼接了一行，所以这里要-1
									XLSX.utils.sheet_add_aoa(wsYear, glist, {origin:{r:mindex+aindex, c:0}}); 
									hblist.push({ s: {c: 1,r: mindex+aindex}, e: {c: 3,r: mindex+gindex-1} });//任务空列全部合并
									hblist.push({ s: {c: 4,r: mindex+aindex}, e: {c: 7,r: mindex+gindex-1} });//学习记录空列全部合并
									hblist.push({ s: {c: 8,r: mindex+aindex}, e: {c: 11,r: mindex+gindex-1} });//考试记录空列全部合并
								}

								
								

								
								
								//当前这个月所占行数合并
								if(maxRow>1){
									hblist.push({ s: {c: 0,r: mindex}, e: {c: 0,r: mindex+maxRow-1} });//月份的列合并情况
								}
								mindex+=maxRow;//当前写到了第几行，最大总行数
								

							})//一个月份循环结束
							
							
						}


						wsYear["!merges"] =hblist;
						for( let key in wsYear ){
							if(key.indexOf("!")==-1){
								wsYear[key].s=styleBase;
							}
						}

						for(var i=0;i<yearCols.length;i++){    
							var chat=String.fromCharCode(65+i);
							wsYear[chat+"1"].s=styleTitle;
							wsYear[chat+"2"].s=styleHead;
						}	

						for(var y=0;y<mindex-2;y++){
							yearRows.push({ hpx: 25 });
						}
						for(var y=2;y<=mindex-2;y++){
							wsYear["A"+y].s=styleHead;
						}
						// wsYear['!freeze']= { xSplit: "1", ySplit: "1", topLeftCell: "B2", activePane: "bottomRight", state: "frozen" }
						

						wsYear['!cols'] = yearCols;
						wsYear['!rows'] = yearRows;

						XLSX.utils.book_append_sheet(wb, wsYear, year.year+"年度");

					}

				
					
					

					

				}

				/* write workbook and force a download */
				XLSX.writeFile(wb, $scope.userinfo.user_Name+"-学习档案.xlsx");

			}







            //========================================================================
            //*****************************下面开始写代码******************************
            //========================================================================
			$scope.fileurl=commonFileUrl;

			$scope.userinfo={};
			$scope.yearList=[];//年份
			$scope.scoreList=[];//成绩top10

			$scope.hideYearBox=function(obj){
				
				if(!obj.show&&obj.monthList==undefined){
					$scope.getReportYear(obj);
				}else{
					obj.show=!obj.show;;
				}
			}
			$scope.hideBox=function(obj){
				obj.show=!obj.show;
			}
            //获取已登录的用户对象，若用户未登录，此方法会退出登录，跳转到登录页面
            //$scope.userInfo=sysUserInfo.getuserinfo();
            $scope.getUserJSON=function(){
                RPS.getReportTotle({ uid: uid }).then(function (data) {
                    if (data.errorcode == 0) {
						$scope.userinfo=data.data.userinfo;
						$("title").html($scope.userinfo.user_Name+"-学习档案")
						$scope.userinfo.orgname="";
						$scope.userinfo.userOrgList.forEach(function(org,index){
							$scope.userinfo.orgname+=($scope.userinfo.orgname.length>0?',':'')+org.organization_Name;
						});
						$scope.userinfo.groupname="";
						$scope.userinfo.userGroupList.forEach(function(group,index){
							$scope.userinfo.groupname+=($scope.userinfo.groupname.length>0?',':'')+group.userGroup_Name;
						});
						$scope.userinfo.rolename="";
						$scope.userinfo.userRoleList.forEach(function(role,index){
							$scope.userinfo.rolename+=($scope.userinfo.rolename.length>0?',':'')+role.roles_Name;
						});

						$scope.yearList=data.data.yearList;
						if($scope.yearList!=undefined&&$scope.yearList.length>0){
							
							$scope.yearList.forEach(function(obj,index){
								obj.year=obj.year
								obj.bxTotleStudyTime=parseFloat(obj.bx).toFixed(1);
								obj.xxTotleStudyTime=parseFloat(obj.xx).toFixed(1);

								obj.bxCompleteIntegral=0;
								obj.xxCompleteIntegral=0;
								obj.bxIntegralShouldCount=0;

								obj.bxArrangeShouldCount=0;
								obj.bxCompleteArrangeCount=0;

								obj.show=false;
								obj.loading=false;
							});
							$scope.getReportYear($scope.yearList[0])
						}
						

						$scope.scoreList=data.data.scoreList;

						$scope.stuTimeEchart();
						$scope.stuExamEchart();
                        //$scope.SumHeight();
                       // $scope.studyEchart();
						$scope.Canvas(data.data.userinfo.user_Name+"（"+data.data.userinfo.organization_Name+"）");
                    } else {
                        alert("获取数据失败！")
                    }
                }, function errorCallback() {
                    alert("获取数据失败！")
                });
			}
			//获取年度报表
			$scope.getReportYear=function(obj){
				
				obj.loading=true;
                RPS.getReportYear({ uid: uid ,year:obj.year}).then(function (data) {
					obj.loading=false;
					obj.show=true;
					$scope.reloadSY();
                    if (data.errorcode == 0) {

						//统计总数量
						obj.bxIntegralShouldCount=data.data.bxIntegralShouldCount;//应修必修学分数
						obj.bxArrangeShouldCount=data.data.bxArrangeShouldCount;//应修必修任务数

						// obj.xxTotleStudyTime=0;//选修总学时 ，从年度里取
						// obj.bxTotleStudyTime=0;//必修总学时 ，从年度里取

						obj.bxCompleteArrangeCount=0;//必修任务已完成数量
						obj.xxCompleteArrangeCount=0;//选修任务已完成数量

						obj.bxCompleteIntegral=0;//必修获得积分
						obj.xxCompleteIntegral=0;//选修获得积分

						//月度统计数据
						obj.bxTimeArray=data.data.bxTimeArray;//月度必修学时统计
						obj.xxTimeArray=data.data.xxTimeArray;//月度选项学时
						obj.bxIntegralArray=data.data.bxIntegralArray;//月度必修学分
						obj.xxIntegralArray=data.data.xxIntegralArray;//月度选修学分

						// setTimeout(function(){
						// 	$scope.yearReportEchart(obj);
						// },50)

						//二类学分
						obj.otList=data.data.otList;
						obj.totleOffTrainIntegral=0;//二类总学分
						obj.totleOffTrainTime=0;//二类总学时
						if(obj.otList!=undefined&&obj.otList!=null&&obj.otList.length>0){
							for(var a=0;a<obj.otList.length;a++){
								if(obj.otList[a].trainIntegral==undefined){
									obj.otList[a].trainIntegral=0;
								}
								if(obj.otList[a].trainStudytime==undefined){
									obj.otList[a].trainStudytime=0;
								}
								if(obj.otList[a].trainDate!=undefined){
									obj.otList[a].trainDate=obj.otList[a].trainDate.split(" ")[0];
								}
								obj.totleOffTrainIntegral+=obj.otList[a].trainIntegral;
								obj.totleOffTrainTime+=obj.otList[a].trainStudytime;
							}
						}else{
							obj.otList=[];
						}

						obj.arrangeGradeCount=0;//当前年份的总任务+班级数量
						obj.arrangeGradeComplete=0;//加载学习考试+班级考勤记录完成的数量

						data.data.arrList.forEach(function(arr,aindex){
							arr.arrage="";
							arr.arragetype="";
							arr.complete="";
						})
						obj.arrList=data.data.arrList;
						obj.gradeList=data.data.gradeList;
						//任务和班级
						if(data.data.arrList.length>0||data.data.gradeList.length>0){
							//总任务数量
							obj.arrangeGradeCount=data.data.arrList.length+data.data.gradeList.length;

							//遍历任务
							for(var a=0;a<obj.arrList.length;a++){

								//已完成必修选修数量
								if(parseFloat(obj.arrList[a].completeCount)>=parseFloat(obj.arrList[a].courser_count)){
									if(obj.arrList[a].isStudy){
										obj.bxCompleteArrangeCount+=1;
									}else{
										obj.xxCompleteArrangeCount+=1;
									}
								}
								obj.arrList[a].loading=false;//loading
								obj.arrList[a].arrIntegral=0;//已获得积分
								$scope.arrangeRecord(obj.arrList[a],obj);
							}

							//遍历班级
							for(var a=0;a<obj.gradeList.length;a++){

								obj.gradeList[a].loading=false;//loading
								//查询学习记录
								$scope.gradeRecord(obj.gradeList[a],obj);
							}
							
						}else{
							obj.monthList=[];
						}
						
						

						
                    } else {
                        alert("获取"+obj.year+"数据失败！")
                    }
                }, function errorCallback() {
					obj.loading=false;
					$scope.reloadSY();
                    alert("获取数据失败！")
                });
            }

			//年度汇总学时图标
			$scope.stuTimeEchart=function(){
				var dom = document.getElementById("stu_container");

				var xxList=[];
				var bxList=[];
				var indicator=[];

				var max=0;
				for(var i=0;i<$scope.yearList.length;i++){
					if(parseInt($scope.yearList[i].xxTotleStudyTime)>max){
						max=$scope.yearList[i].xxTotleStudyTime;
					}
					if(parseInt($scope.yearList[i].bxTotleStudyTime)>max){
						max=$scope.yearList[i].bxTotleStudyTime;
					}
				}
				for(var i=0;i<$scope.yearList.length;i++){
					var obj = {}
					obj.text = $scope.yearList[i].year;
					obj.max = max;
					indicator.push(obj)
					bxList.push($scope.yearList[i].bxTotleStudyTime)
					xxList.push($scope.yearList[i].xxTotleStudyTime)
				}
				var myChart = echarts.init(dom);
				option = {
					tooltip: {
						trigger: 'axis'
					},
					legend: {
						x: 'center',
						y:310,
						data: ['必修学时', '选修学时']
					},
					color:['#3399ff','#ff6666'],
					radar: [
						{
							indicator:indicator,
							center: ['50%', '60%'],
							radius: 85
						}
					],
					series: [
						{
							type: 'radar',
							tooltip: {
								trigger: 'item'
							},
							itemStyle: {normal: {areaStyle: {type: 'default'}}},
							data: [
								{
									value: bxList,
									name: '必修学时'
								}, {
									value: xxList,
									name: '选修学时'
								}
							]
						}
					]
				}
				if (option && typeof option === "object") {
					myChart.setOption(option, true);
				}
			}
			
			//考试成绩top10
			$scope.stuExamEchart=function(){
                var indicator = []
				var slist=[];

				var max=0;
				for(var i=0;i<$scope.scoreList.length;i++){
					if($scope.scoreList[i].score>max){
						max=$scope.scoreList[i].score;
					}
				}

				for(var i=0;i<$scope.scoreList.length;i++){
					var obj = {}
					obj.text = $scope.scoreList[i].paperName;
					obj.max = max;
					indicator.push(obj)
					slist.push($scope.scoreList[i].score)
				}
				
				var dom = document.getElementById("exam_container");
				
				var myChart = echarts.init(dom);
				
				option = {
					tooltip: {
						trigger: 'axis'
					},
					legend: {
						x: 'center',
						y:310,
						data: ['答题分数']
					},
					color:['#3399ff','#ff6666'],
					radar: [
						{
							indicator:indicator,
							center: ['50%', '60%'],
							radius: 85
						}
					],
					series: [
						{
							type: 'radar',
							tooltip: {
								trigger: 'item'
							},
							itemStyle: {normal: {areaStyle: {type: 'default'}}},
							data: [
								{
									value:  slist,
									name: '答题分数'
								}
							]
						}
					]
				}
				if (option && typeof option === "object") {
					myChart.setOption(option, true);
				}
				
            }
            
			//年度月份柱形图
			$scope.yearReportEchart=function(obj,year){
				//$scope.completeMonth(obj);
				var report = document.getElementById(year+"report");
				var myChartreport = echarts.init(report);
				console.log(obj);
				
				var option = {
					title: {
						text: '',
						subtext: ''
					},
					tooltip: {
						trigger: 'axis',
						axisPointer: {
							type: 'shadow'
						}
					},
					legend: {
						data: ['必修学分', '选修学分','必修学时', '选修学时']
					},
					grid: {
						left: '3%',
						right: '4%',
						bottom: '3%',
						containLabel: true
					},
					xAxis: {
						type: 'category',
						data: obj.mouthlist
					},
					yAxis: {
						
						type: 'value',
						boundaryGap: [0, 0.01]
					},
					series: [
						{
							name: '必修学分',
							type: 'bar',
							data: obj.intbxlist
						},
						{
							name: '选修学分',
							type: 'bar',
							data: obj.intxxlist
						},
						{
							name: '必修学时',
							type: 'bar',
							data: obj.bxlist
						},
						{
							name: '选修学时',
							type: 'bar',
							data: obj.xxlist
						}
					]
				};



				if (option && typeof option === "object") {
					myChartreport.setOption(option, true);
				}
				setTimeout(function(){
					$scope.reloadSY();
				},50);
				
			}
		   
			
			//补充没有的月份
			$scope.completeMonth=function(obj){
				for(var a=1;a<=12;a++){

					//必修学时
					var find=false;
					for(var b=0;b<obj.bxTimeArray.length;b++){
						if(obj.bxTimeArray.month==a){
							find=true;
						}
					}
					if(!find){ obj.bxTimeArray.push({month:a,num:0})}
					//选修学时
					find=false;
					for(var b=0;b<obj.xxTimeArray.length;b++){
						if(obj.xxTimeArray.month==a){
							find=true;
						}
					}
					if(!find){ obj.xxTimeArray.push({month:a,num:0})}
					//必修学分
					find=false;
					for(var b=0;b<obj.bxIntegralArray.length;b++){
						if(obj.bxIntegralArray.month==a){
							find=true;
						}
					}
					if(!find){ obj.bxIntegralArray.push({month:a,num:0})}
					//选项学分
					find=false;
					for(var b=0;b<obj.xxIntegralArray.length;b++){
						if(obj.xxIntegralArray.month==a){
							find=true;
						}
					}
					if(!find){ obj.xxIntegralArray.push({month:a,num:0})}
				}
				obj.bxTimeArray=obj.bxTimeArray.sort(function(obj1,obj2){
					return obj1.month-obj2.month;
				})
				obj.xxTimeArray=obj.xxTimeArray.sort(function(obj1,obj2){
					return obj1.month-obj2.month;
				})
				obj.bxIntegralArray=obj.bxIntegralArray.sort(function(obj1,obj2){
					return obj1.month-obj2.month;
				})
				obj.xxIntegralArray=obj.xxIntegralArray.sort(function(obj1,obj2){
					return obj1.month-obj2.month;
				})
			}

			//任务，班级合并月份
			$scope.arrangeMonth=function(list,glist){
				//拆分每个月都有那些任务{month:1,list:[],glist:[],show:false},月份，任务
				var monthList=[];
				//任务
				for(var a=0;a<list.length;a++){

					var m=new Date(list[a].start_Date).getMonth()+1;//当前任务的月份
					var find=false;
					//查找当前集合里是否存在这个月份
					for(var b=0;b<monthList.length;b++){
						if(monthList[b].month==m){
							monthList[b].list.push(list[a]);//找到了，就归类进去
							find=true;
							break;
						}
					}
					//不存在就新增
					if(!find){ 
						var alist=[];
						alist.push(list[a]);
						monthList.push({month:m,list:alist,glist:[],show:true})
					}

				}
				//班级
				for(var a=0;a<glist.length;a++){

					glist[a].loading=false;//loading

					var m=new Date(glist[a].enrollTime).getMonth()+1;//当前任务的月份
					var find=false;
					//查找当前集合里是否存在这个月份
					for(var b=0;b<monthList.length;b++){
						if(monthList[b].month==m){
							monthList[b].glist.push(glist[a]);//找到了，就归类进去
							find=true;
							break;
						}
					}
					//不存在就新增
					if(!find){ 
						var alist=[];
						alist.push(glist[a]);
						monthList.push({month:m,list:[],glist:alist,show:true})
					}

				}
				monthList=monthList.sort(function(obj1,obj2){
					return obj2.month-obj1.month;
				})
				return monthList;
			}
			
			//获得班级的考勤记录
			$scope.gradeRecord=function(obj,year){
				obj.loading=true;
				RPS.getGradeSign({ uid: uid ,gid:obj.gradeId}).then(function (data) {
					obj.loading=false;
                    if (data.errorcode == 0) {
						if(data.data.signArray!=undefined&&data.data.signArray!=null&&data.data.signArray.length>0){
							obj.attList=data.data.signArray;
						}else{
							obj.attList=[];
						}
						

					}else if(data.errorcode!=6){
						alert(data.errormsg);
					}else{
						alert("获得班级记录失败！");
					}
					$scope.arrangeRecordLoad(obj,year);
				},function(){
					obj.loading=false;
					$scope.arrangeRecordLoad(obj,year);
					console.log("获取班级记录异常")
				})
			}
			
			//获得任务的学习记录，考试记录，积分
			$scope.arrangeRecord=function(obj,year){
				obj.loading=true;
				RPS.getArrangeReport({ uid: uid ,aid:obj.id,year:""}).then(function (data) {
					
					obj.loading=false;
                    if (data.errorcode == 0) {

						for(var a=0;a<data.data.studyList.length;a++){
							data.data.studyList[a].json_details="";
							if(data.data.studyList[a].stu_count==undefined||data.data.studyList[a].stu_count==null){
								data.data.studyList[a].stu_count=0;
							}else{
								data.data.studyList[a].stu_count=parseFloat(data.data.studyList[a].stu_count).toFixed(1);
							}
						}
						for(var a=0;a<data.data.scoreList.length;a++){
							data.data.scoreList[a].examRecordJson="";
							data.data.scoreList[a].score=parseFloat(data.data.scoreList[a].score).toFixed(1);
						}
						//学习记录
						obj.studyList=data.data.studyList;

						//考试记录
						obj.scoreList=data.data.scoreList;
						//积分
						obj.arrIntegral=data.data.arrIntegral;

					}else if(data.errorcode!=6){
						alert(data.errormsg);
					}else{
						alert("获得任务记录失败！");
					}
					$scope.arrangeRecordLoad(obj,year);

				},function(){
					$scope.arrangeRecordLoad(obj,year);
					obj.loading=false;
					console.log("获取任务记录异常")
				})
			}

			//任务记录加载进度判断
			$scope.arrangeRecordLoad=function(obj,year){
				year.arrangeGradeComplete+=1;

				
				//这里是加载完成
				if(year.arrangeGradeCount<=year.arrangeGradeComplete){

					year.monthList=$scope.arrangeMonth(year.arrList,year.gradeList);

					var bxlist=[];//必修学时
					var xxlist=[];//选修学时
					var intbxlist=[];//必修学分
					var intxxlist=[];//选修学分
					var mouthlist=[];

					for(var a=0;a<year.monthList.length;a++){
						mouthlist.push(year.monthList[a].month);
						var bxtime=0;
						var xxtime=0;
						var bxint=0;
						var xxint=0;
						//遍历任务
						for(var b=0;b<year.monthList[a].list.length;b++){

							//********************学分********************
							if(year.monthList[a].list[b].arrIntegral>0){
								//必修
								if(year.monthList[a].list[b].isStudy){
									year.bxCompleteIntegral+=year.monthList[a].list[b].arrIntegral;
									bxint+=year.monthList[a].list[b].arrIntegral;
								//选修
								}else{
									year.xxCompleteIntegral+=year.monthList[a].list[b].arrIntegral;
									xxint+=year.monthList[a].list[b].arrIntegral;
								}
							}
							//********************学时********************
							//统计学时
							if(year.monthList[a].list[b].studyList!=undefined&&year.monthList[a].list[b].studyList.length>0){
								for(var c=0;c<year.monthList[a].list[b].studyList.length;c++){
									//必修
									if(year.monthList[a].list[b].isStudy){
										//year.bxTotleStudyTime+=parseFloat(year.monthList[a].list[b].studyList[c].stu_count);
										bxtime+=parseFloat(year.monthList[a].list[b].studyList[c].stu_count);
									//选修
									}else{
										//year.xxTotleStudyTime+=parseFloat(year.monthList[a].list[b].studyList[c].stu_count);
										xxtime+=parseFloat(year.monthList[a].list[b].studyList[c].stu_count);
									}
								}
							}

						}
						intbxlist.push(bxint);
						intxxlist.push(xxint);
						bxlist.push(bxtime);
						xxlist.push(xxtime);
					};
					$scope.yearReportEchart({bxlist:bxlist,xxlist:xxlist,intbxlist:intbxlist,intxxlist:intxxlist,mouthlist:mouthlist},year.year)
						
					
				}

			}
			
			//================================水印开始=================================
			$scope.nameImg="";
			//生成图片 $scope.nameImg
			$scope.Canvas=function(name){

				var width=name.length*20; //每个字30站位+40左右填充

			//绘制文字到canvas，判断换行位置，和设置canvas高度
				var settings = {
					canvas:document.getElementById("name_canvas"), //canvas对象
					canvasWidth:width, //canvas的宽度
					drawStartX:-20, //绘制字符串起始x坐标
					drawStartY:0, //绘制字符串起始y坐标
					lineHeight:100, //文字的行高
					font:"15px '宋体'", //文字样式
					text:name, //需要绘制的文本
					drawWidth:width, //文字显示的宽度
					color:"#eee", //文字的颜色
					backgroundColor:"#ffffff", //背景颜色
				};
		
		
				//获取2d的上线文开始设置相关属性
				var canvas = settings.canvas;
				canvas.width = settings.canvasWidth;
				canvas.height = name.length*10;
				settings.drawStartY = canvas.height-20;
				var ctx = canvas.getContext("2d");

				
				//绘制背景色
				ctx.fillStyle = settings.backgroundColor;
				ctx.fillRect(0,0,canvas.width,canvas.height);
		
				//绘制文字
				ctx.font = settings.font;
				ctx.fillStyle = settings.color;
				var lineWidth = 0; //当前行的绘制的宽度
				var lastTextIndex = 0; //已经绘制上canvas最后的一个字符的下标
				//由于改变canvas 的高度会导致绘制的纹理被清空，所以，不预先绘制，先放入到一个数组当中
				var arr = [];
				for(var i = 0; i<settings.text.length; i++){
					//获取当前的截取的字符串的宽度
					lineWidth = ctx.measureText(settings.text.substr(lastTextIndex,i-lastTextIndex)).width;
					
					if(lineWidth > settings.drawWidth){
						//判断最后一位是否是标点符号
						if(judgePunctuationMarks(settings.text[i-1])){
							arr.push(settings.text.substr(lastTextIndex,i-lastTextIndex));
							lastTextIndex = i;
						}else{
							arr.push(settings.text.substr(lastTextIndex,i-lastTextIndex-1));
							lastTextIndex = i-1;
						}
					}
					//将最后多余的一部分添加到数组
					if(i === settings.text.length - 1){
						arr.push(settings.text.substr(lastTextIndex,i-lastTextIndex+1));
					}
				}
		
				ctx.rotate(-25 * Math.PI / 180);
		
				ctx.font = settings.font;
				ctx.fillStyle = settings.color;
				for(var i =0; i<arr.length; i++){
					ctx.fillText(arr[i],settings.drawStartX,settings.drawStartY+i*settings.lineHeight);
				}

				//判断是否是需要避开的标签符号
				function judgePunctuationMarks(value) {
					var arr = [".",",",";","?","!",":","\"","，","。","？","！","；","：","、"];
					for(var i = 0; i< arr.length; i++){
						if(value === arr[i]){
							return true;
						}
					}
					return false;
				}
				//调用函数获取到img的data数据
				var base64code=canvas.toDataURL();
				var nameImg=URL.createObjectURL($scope.dataURLtoBlob(base64code));
				$scope.nameImg=nameImg;
				$(".xuexidangan_column").css("background-image",'url('+nameImg+')')

			}
			$scope.showSY=true;
            $scope.hideSY=function(){
				if($scope.showSY){
					$(".xuexidangan_column").css("background-image",'url()');
				}else{
					$(".xuexidangan_column").css("background-image",'url('+$scope.nameImg+')')
				}
				$scope.showSY=!$scope.showSY;
			}
			//重新装载水印
			$scope.reloadSY=function(){
				if($scope.showSY){
					$(".xuexidangan_column").css("background-image",'url('+$scope.nameImg+')')
				}
			}
			$scope.dataURLtoBlob=function(dataurl) {
				var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
					bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
				while(n--){
					u8arr[n] = bstr.charCodeAt(n);
				}
				return new Blob([u8arr], {type:mime});
			}
			//================================水印结束=================================


             $scope.getUserJSON();
            //========================================================================
            //*********************************代码结束********************************
            //========================================================================

			//**********************************下载**********************************

			$scope.downImgUrl="";
			$scope.keyDown=function(e){
				e.preventDefault();
				var currKey=0, e=e||event||window.event;
				currKey = e.keyCode||e.which||e.charCode;
				if(currKey == 83 && (e.ctrlKey||e.metaKey)){
					var getPixelRatio = function (context) { // 获取设备的PixelRatio
						var backingStore = context.backingStorePixelRatio ||
							context.webkitBackingStorePixelRatio ||
							context.mozBackingStorePixelRatio ||
							context.msBackingStorePixelRatio ||
							context.oBackingStorePixelRatio ||
							context.backingStorePixelRatio || 0.5;
						return (window.devicePixelRatio || 0.5) / backingStore;
					};
					//生成的图片名称
					var imgName = "cs.jpg";
					var shareContent = document.getElementById("ryda");
					var height = shareContent.offsetHeight;//
					// var width =shareContent.offsetWidth*(7000/shareContent.offsetHeight) //;
					var width =shareContent.offsetWidth;

					
					var canvas = document.createElement("canvas");
					var context = canvas.getContext('2d');
					var scale = getPixelRatio(context); //将canvas的容器扩大PixelRatio倍，再将画布缩放，将图像放大PixelRatio倍。
					canvas.top=0;
					canvas.width = width * scale;
					canvas.height = height * scale;
					canvas.style.width = width + 'px';
					canvas.style.height = height + 'px';
					context.scale(scale, scale);

					var rect = shareContent.getBoundingClientRect() // 获取元素相对于视口的坐标
					canvas.getContext('2d').translate(-rect.left-3, -50);//重置绘图坐标,如果有滚动条，这里要加上滚动条的宽度和高度
					var opts = {
						scale: scale,
						canvas: canvas,
						width: width,
						height: height,
						dpi: window.devicePixelRatio
					};
					html2canvas(shareContent, opts).then(function (canvas) {
						context.imageSmoothingEnabled = false;
						context.webkitImageSmoothingEnabled = false;
						context.msImageSmoothingEnabled = false;
						context.imageSmoothingEnabled = false;
						var dataUrl = canvas.toDataURL('image/jpeg', 1.0);
						$(".download_img img").attr("src",dataUrl);
						$(".download_img a").attr("src",dataUrl);

						var link = document.createElement("a");
						var blob = $scope.dataURLtoBlob(dataUrl);
						var objurl = URL.createObjectURL(blob);
						link.download = "人员档案.png";
						link.href = objurl;
						link.click();
					});

					return false;
				}
			}
			//document.onkeydown = $scope.keyDown;
			
			$scope.getBase64Image=function(img) {
				let canvas = document.createElement("canvas");
				canvas.width = img.width;
				canvas.height = img.height;
				let ctx = canvas.getContext("2d");
				ctx.drawImage(img, 0, 0, img.width, img.height);
				let ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
				let dataURL = canvas.toDataURL("image/" + ext);
				return dataURL;
			}

        } ]);

    </script>
	 <script src="/system/service/personnelpathservice.js" type="text/javascript"></script>
	 <!-- <script src="/framework/html2canvas.js" type="text/javascript"></script> -->
</body>
</html>
